#endif /* ! HAVE_LINUX_OPENAT2_H */
#ifndef HAVE_OPENAT2
-long rep_openat2(int dirfd, const char *pathname,
- struct open_how *how, size_t size);
-#define openat2(dirfd, pathname, how, size) \
- rep_openat2(dirfd, pathname, how, size)
+#define HAVE_OPENAT2
+#ifdef __linux__
+#include <sys/syscall.h>
+static inline long openat2(int dirfd, const char *pathname,
+ struct open_how *how, size_t size) {
+ return syscall(SYS_openat2, dirfd, pathname, how, size);
+}
+#else
+#define openat2(dirfd, path, how, size) (errno = -ENOSYS, -1)
+#endif
#endif /* !HAVE_OPENAT2 */
#ifdef DISABLE_OPATH